using System;
using System.Data;

using Wicresoft.Common;

namespace Wicresoft.Messages.Entity
{
    [Table("MessageDraft", "", "Wicresoft.Messages.ConnectionString")]
    public class MessageDraft : Info
    {
        #region SQL column name consts
        public const string SQLCOL_DRAFTID = "DraftID";
        public const string SQLCOL_SENDERNAME = "SenderName";
        public const string SQLCOL_LASTMODIFYTIME = "LastModifyTime";
        public const string SQLCOL_TITLE = "Title";
        public const string SQLCOL_TEXT = "Text";
        public const string SQLCOL_USERRECEIVER = "UserReceiver";
        public const string SQLCOL_DEPARTMENTRECEIVER = "DepartmentReceiver";
        public const string SQLCOL_OUTERRECEIVER = "OuterReceiver";
        public const string SQLCOL_SENDTIME = "SendTime";
        public const string SQLCOL_NEEDFEEDBACK = "NeedFeedBack";
        public const string SQLCOL_FEEDBACKOPTIONS = "FeedBackOptions";
        public const string SQLCOL_ATTACHMENTID = "AttachmentID";
        public const string SQLCOL_FEEDBACKFORWARD = "FeedBackForward";
        #endregion


        #region Contructors
        /// <summary>
        /// Construct empty entity
        /// </summary>
        public MessageDraft() { }

        /// <summary>
        /// Construct entity by primary key, other fields will be assigned by 
        /// "Load" method.
        /// </summary>
        public MessageDraft(Guid DraftID)
        {
            this.DraftID = DraftID;
        }
        #endregion

        public override void Init(DataRow row)
        {
            DraftID = (Guid)ObjectType.GuidTypeHelper.Read(row[SQLCOL_DRAFTID]);
            SenderName = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_SENDERNAME]);
            LastModifyTime = (DateTime)ObjectType.DateTimeTypeHelper.Read(row[SQLCOL_LASTMODIFYTIME]);
            Title = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_TITLE]);
            Text = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_TEXT]);
            UserReceiver = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_USERRECEIVER]);
            DepartmentReceiver = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_DEPARTMENTRECEIVER]);
            OuterReceiver = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_OUTERRECEIVER]);
            SendTime = (DateTime)ObjectType.DateTimeTypeHelper.Read(row[SQLCOL_SENDTIME]);
            NeedFeedBack = (bool)ObjectType.BooleanTypeHelper.Read(row[SQLCOL_NEEDFEEDBACK]);
            FeedBackOptions = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_FEEDBACKOPTIONS]);
            AttachmentID = (Guid)ObjectType.GuidTypeHelper.Read(row[SQLCOL_ATTACHMENTID]);
            FeedBackForward = (bool)ObjectType.BooleanTypeHelper.Read(row[SQLCOL_FEEDBACKFORWARD]);
        }

        #region Properties
        #region Property <Guid> DraftID
        [Property("DraftID", 16, SqlDbType.UniqueIdentifier, false, true)]
        public Guid DraftID
        {
            get { return _DraftID; }
            set { _DraftID = value; }
        }
        private Guid _DraftID = Guid.Empty;
        #endregion

        #region Property <string> SenderName
        [Property("SenderName", 100, SqlDbType.NVarChar, false, false)]
        public string SenderName
        {
            get { return _SenderName; }
            set { _SenderName = value; }
        }
        private string _SenderName = null;
        #endregion

        #region Property <DateTime> LastModifyTime
        [Property("LastModifyTime", 16, SqlDbType.DateTime, false, false)]
        public DateTime LastModifyTime
        {
            get { return _LastModifyTime; }
            set { _LastModifyTime = value; }
        }
        private DateTime _LastModifyTime = DateTime.MinValue;
        #endregion

        #region Property <string> Title
        [Property("Title", 2000, SqlDbType.NVarChar, false, false)]
        public string Title
        {
            get { return _Title; }
            set { _Title = value; }
        }
        private string _Title = null;
        #endregion

        #region Property <string> Text
        [Property("Text", 2147483646, SqlDbType.NText, false, false)]
        public string Text
        {
            get { return _Text; }
            set { _Text = value; }
        }
        private string _Text = null;
        #endregion

        #region Property <string> UserReceiver
        [Property("UserReceiver", 2147483646, SqlDbType.NText, false, false)]
        public string UserReceiver
        {
            get { return _UserReceiver; }
            set { _UserReceiver = value; }
        }
        private string _UserReceiver = null;
        #endregion

        #region Property <string> DepartmentReceiver
        [Property("DepartmentReceiver", 2147483646, SqlDbType.NText, false, false)]
        public string DepartmentReceiver
        {
            get { return _DepartmentReceiver; }
            set { _DepartmentReceiver = value; }
        }
        private string _DepartmentReceiver = null;
        #endregion

        #region Property <string> OuterReceiver
        [Property("OuterReceiver", 2147483646, SqlDbType.NText, false, false)]
        public string OuterReceiver
        {
            get { return _OuterReceiver; }
            set { _OuterReceiver = value; }
        }
        private string _OuterReceiver = null;
        #endregion

        #region Property <DateTime> SendTime
        [Property("SendTime", 16, SqlDbType.DateTime, false, false)]
        public DateTime SendTime
        {
            get { return _SendTime; }
            set { _SendTime = value; }
        }
        private DateTime _SendTime = DateTime.MinValue;
        #endregion

        #region Property <bool> NeedFeedBack
        [Property("NeedFeedBack", 1, SqlDbType.Bit, false, false)]
        public bool NeedFeedBack
        {
            get { return _NeedFeedBack; }
            set { _NeedFeedBack = value; }
        }
        private bool _NeedFeedBack = false;
        #endregion

        #region Property <string> FeedBackOptions
        [Property("FeedBackOptions", 2147483646, SqlDbType.NText, false, false)]
        public string FeedBackOptions
        {
            get { return _FeedBackOptions; }
            set { _FeedBackOptions = value; }
        }
        private string _FeedBackOptions = null;
        #endregion

        #region Property <Guid> AttachmentID
        [Property("AttachmentID", 16, SqlDbType.UniqueIdentifier, false, false)]
        public Guid AttachmentID
        {
            get { return _AttachmentID; }
            set { _AttachmentID = value; }
        }
        private Guid _AttachmentID = Guid.Empty;
        #endregion

        #region Property <bool> FeedBackForward
        [Property("FeedBackForward", 1, SqlDbType.Bit, false, false)]
        public bool FeedBackForward
        {
            get { return _FeedBackForward; }
            set { _FeedBackForward = value; }
        }
        private bool _FeedBackForward = false;
        #endregion
        #endregion




    }
}
